3.46 \(\int \frac{\tan (c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^2} \, dx\)

Optimal. Leaf size=76 \[ \frac{A+3 i B}{4 a^2 d (1+i \tan (c+d x))}-\frac{x (B+i A)}{4 a^2}-\frac{A+i B}{4 d (a+i a \tan (c+d x))^2} \]

[Out]

-((I*A + B)*x)/(4*a^2) + (A + (3*I)*B)/(4*a^2*d*(1 + I*Tan[c + d*x])) - (A + I*B)/(4*d*(a + I*a*Tan[c + d*x])^
2)

________________________________________________________________________________________

Rubi [A]  time = 0.130703, antiderivative size = 76, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 32, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.094, Rules used = {3590, 3526, 8} \[ \frac{A+3 i B}{4 a^2 d (1+i \tan (c+d x))}-\frac{x (B+i A)}{4 a^2}-\frac{A+i B}{4 d (a+i a \tan (c+d x))^2} \]

Antiderivative was successfully verified.

[In]

Int[(Tan[c + d*x]*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x])^2,x]

[Out]

-((I*A + B)*x)/(4*a^2) + (A + (3*I)*B)/(4*a^2*d*(1 + I*Tan[c + d*x])) - (A + I*B)/(4*d*(a + I*a*Tan[c + d*x])^
2)

Rule 3590

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_
.) + (f_.)*(x_)]), x_Symbol] :> -Simp[((A*b - a*B)*(a*c + b*d)*(a + b*Tan[e + f*x])^m)/(2*a^2*f*m), x] + Dist[
1/(2*a*b), Int[(a + b*Tan[e + f*x])^(m + 1)*Simp[A*b*c + a*B*c + a*A*d + b*B*d + 2*a*B*d*Tan[e + f*x], x], x],
 x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a*d, 0] && LtQ[m, -1] && EqQ[a^2 + b^2, 0]

Rule 3526

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> -Simp[((
b*c - a*d)*(a + b*Tan[e + f*x])^m)/(2*a*f*m), x] + Dist[(b*c + a*d)/(2*a*b), Int[(a + b*Tan[e + f*x])^(m + 1),
 x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && LtQ[m, 0]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rubi steps

\begin{align*} \int \frac{\tan (c+d x) (A+B \tan (c+d x))}{(a+i a \tan (c+d x))^2} \, dx &=-\frac{A+i B}{4 d (a+i a \tan (c+d x))^2}-\frac{i \int \frac{a (A+i B)+2 a B \tan (c+d x)}{a+i a \tan (c+d x)} \, dx}{2 a^2}\\ &=\frac{A+3 i B}{4 a^2 d (1+i \tan (c+d x))}-\frac{A+i B}{4 d (a+i a \tan (c+d x))^2}-\frac{(i A+B) \int 1 \, dx}{4 a^2}\\ &=-\frac{(i A+B) x}{4 a^2}+\frac{A+3 i B}{4 a^2 d (1+i \tan (c+d x))}-\frac{A+i B}{4 d (a+i a \tan (c+d x))^2}\\ \end{align*}

Mathematica [A]  time = 0.53058, size = 92, normalized size = 1.21 \[ \frac{\sec ^2(c+d x) ((-4 A d x-i A+4 i B d x+B) \sin (2 (c+d x))+(4 i A d x+A+B (4 d x+i)) \cos (2 (c+d x))-4 i B)}{16 a^2 d (\tan (c+d x)-i)^2} \]

Antiderivative was successfully verified.

[In]

Integrate[(Tan[c + d*x]*(A + B*Tan[c + d*x]))/(a + I*a*Tan[c + d*x])^2,x]

[Out]

(Sec[c + d*x]^2*((-4*I)*B + (A + (4*I)*A*d*x + B*(I + 4*d*x))*Cos[2*(c + d*x)] + ((-I)*A + B - 4*A*d*x + (4*I)
*B*d*x)*Sin[2*(c + d*x)]))/(16*a^2*d*(-I + Tan[c + d*x])^2)

________________________________________________________________________________________

Maple [B]  time = 0.03, size = 162, normalized size = 2.1 \begin{align*}{\frac{A}{4\,{a}^{2}d \left ( \tan \left ( dx+c \right ) -i \right ) ^{2}}}+{\frac{{\frac{i}{4}}B}{{a}^{2}d \left ( \tan \left ( dx+c \right ) -i \right ) ^{2}}}-{\frac{{\frac{i}{4}}A}{{a}^{2}d \left ( \tan \left ( dx+c \right ) -i \right ) }}+{\frac{3\,B}{4\,{a}^{2}d \left ( \tan \left ( dx+c \right ) -i \right ) }}-{\frac{\ln \left ( \tan \left ( dx+c \right ) -i \right ) A}{8\,{a}^{2}d}}+{\frac{{\frac{i}{8}}\ln \left ( \tan \left ( dx+c \right ) -i \right ) B}{{a}^{2}d}}+{\frac{A\ln \left ( \tan \left ( dx+c \right ) +i \right ) }{8\,{a}^{2}d}}-{\frac{{\frac{i}{8}}B\ln \left ( \tan \left ( dx+c \right ) +i \right ) }{{a}^{2}d}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(tan(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^2,x)

[Out]

1/4/d/a^2/(tan(d*x+c)-I)^2*A+1/4*I/d/a^2/(tan(d*x+c)-I)^2*B-1/4*I/d/a^2/(tan(d*x+c)-I)*A+3/4/d/a^2/(tan(d*x+c)
-I)*B-1/8/d/a^2*ln(tan(d*x+c)-I)*A+1/8*I/d/a^2*ln(tan(d*x+c)-I)*B+1/8/d/a^2*A*ln(tan(d*x+c)+I)-1/8*I/d/a^2*B*l
n(tan(d*x+c)+I)

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: RuntimeError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^2,x, algorithm="maxima")

[Out]

Exception raised: RuntimeError

________________________________________________________________________________________

Fricas [A]  time = 1.42338, size = 154, normalized size = 2.03 \begin{align*} \frac{{\left ({\left (-4 i \, A - 4 \, B\right )} d x e^{\left (4 i \, d x + 4 i \, c\right )} + 4 i \, B e^{\left (2 i \, d x + 2 i \, c\right )} - A - i \, B\right )} e^{\left (-4 i \, d x - 4 i \, c\right )}}{16 \, a^{2} d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^2,x, algorithm="fricas")

[Out]

1/16*((-4*I*A - 4*B)*d*x*e^(4*I*d*x + 4*I*c) + 4*I*B*e^(2*I*d*x + 2*I*c) - A - I*B)*e^(-4*I*d*x - 4*I*c)/(a^2*
d)

________________________________________________________________________________________

Sympy [A]  time = 2.05259, size = 167, normalized size = 2.2 \begin{align*} \begin{cases} \frac{\left (16 i B a^{2} d e^{4 i c} e^{- 2 i d x} + \left (- 4 A a^{2} d e^{2 i c} - 4 i B a^{2} d e^{2 i c}\right ) e^{- 4 i d x}\right ) e^{- 6 i c}}{64 a^{4} d^{2}} & \text{for}\: 64 a^{4} d^{2} e^{6 i c} \neq 0 \\x \left (\frac{i A + B}{4 a^{2}} - \frac{\left (i A e^{4 i c} - i A + B e^{4 i c} - 2 B e^{2 i c} + B\right ) e^{- 4 i c}}{4 a^{2}}\right ) & \text{otherwise} \end{cases} + \frac{x \left (- i A - B\right )}{4 a^{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))**2,x)

[Out]

Piecewise(((16*I*B*a**2*d*exp(4*I*c)*exp(-2*I*d*x) + (-4*A*a**2*d*exp(2*I*c) - 4*I*B*a**2*d*exp(2*I*c))*exp(-4
*I*d*x))*exp(-6*I*c)/(64*a**4*d**2), Ne(64*a**4*d**2*exp(6*I*c), 0)), (x*((I*A + B)/(4*a**2) - (I*A*exp(4*I*c)
 - I*A + B*exp(4*I*c) - 2*B*exp(2*I*c) + B)*exp(-4*I*c)/(4*a**2)), True)) + x*(-I*A - B)/(4*a**2)

________________________________________________________________________________________

Giac [A]  time = 1.34941, size = 147, normalized size = 1.93 \begin{align*} \frac{\frac{2 \,{\left (A - i \, B\right )} \log \left (-i \, \tan \left (d x + c\right ) + 1\right )}{a^{2}} - \frac{2 \,{\left (A - i \, B\right )} \log \left (-i \, \tan \left (d x + c\right ) - 1\right )}{a^{2}} + \frac{3 \, A \tan \left (d x + c\right )^{2} - 3 i \, B \tan \left (d x + c\right )^{2} - 10 i \, A \tan \left (d x + c\right ) + 6 \, B \tan \left (d x + c\right ) - 3 \, A - 5 i \, B}{a^{2}{\left (\tan \left (d x + c\right ) - i\right )}^{2}}}{16 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(tan(d*x+c)*(A+B*tan(d*x+c))/(a+I*a*tan(d*x+c))^2,x, algorithm="giac")

[Out]

1/16*(2*(A - I*B)*log(-I*tan(d*x + c) + 1)/a^2 - 2*(A - I*B)*log(-I*tan(d*x + c) - 1)/a^2 + (3*A*tan(d*x + c)^
2 - 3*I*B*tan(d*x + c)^2 - 10*I*A*tan(d*x + c) + 6*B*tan(d*x + c) - 3*A - 5*I*B)/(a^2*(tan(d*x + c) - I)^2))/d